'/
' MOTEP - Massive Online Text Environment Project
' --------------------------------------------------------------------------------
' MOTEP Server
' 
' GUI.bmx
' 
' (c) Anton Berlin. All Rights Reserved.
'/

incbin "..\Data\Fonts\Arial.ttf"
incbin "..\Data\Fonts\Ariblk.ttf"
incbin "..\Data\Fonts\BlackChancery.ttf"
incbin "..\Data\Fonts\Cour.ttf"
incbin "..\Data\Fonts\Courbd.ttf"
incbin "..\Data\Fonts\Lsans.ttf"
incbin "..\Data\Fonts\Tahoma.ttf"
incbin "..\Data\Fonts\Verdana.ttf"
incbin "..\Data\Fonts\Verdanab.ttf"

global defaultFont:TImageFont
global defaultFont2:TImageFont
global defaultFont3:TImageFont
global meterBar:TImageFont
global verdanaSmall:TImageFont
global verdanaMedium:TImageFont
global verdanaBig:TImageFont

global framesThatHavePassed:int



' Load fonts to the memory
function loadFonts()
	WriteLine(logHandle, "Loading fonts to memory.")
	defaultFont   = LoadImageFont("incbin::..\Data\Fonts\Courbd.ttf",   14, SMOOTHFONT)
	defaultFont2  = LoadImageFont("incbin::..\Data\Fonts\Arial.ttf",    12, SMOOTHFONT)
	defaultFont3  = LoadImageFont("incbin::..\Data\Fonts\Verdana.ttf",  12, SMOOTHFONT)
	meterBar      = LoadImageFont("incbin::..\Data\Fonts\Courbd.ttf",   10, SMOOTHFONT)
	verdanaSmall  = LoadImageFont("incbin::..\Data\Fonts\Verdanab.ttf", 12, SMOOTHFONT)
	verdanaMedium = LoadImageFont("incbin::..\Data\Fonts\Verdanab.ttf", 16, BOLDFONT + SMOOTHFONT)
	verdanaBig    = LoadImageFont("incbin::..\Data\Fonts\Verdanab.ttf", 24, BOLDFONT + SMOOTHFONT)
end function

' Draw current frame in-game
function drawFrame_Server()
	clrWhite() ' Reset the color of text's and other manual drawings to white
	drawGUI_Server() ' Draw the GUI
	drawOutput() ' Draw all the output text
	framesThatHavePassed :+ 1
end function

' Draw the GUI
function drawGUI_Server()
	local oldr:int, oldg:int, oldb:int, meterPerc:int
	
	SetImageFont(defaultFont)
	clrBrown()
	
	' Save old colors
	oldr = oldColorR
	oldg = oldColorG
	oldb = oldColorB
	
	clrDarkBrown();	DrawLine(0, 92, 800, 92) ' Upper margin
	'clrDarkBrown();	DrawLine(0, 93, 800, 93) ' Upper margin
	'clrBlack();		DrawLine(0, 94, 800, 94) ' Upper margin
	'				DrawLine(0, 550, 800, 550) ' Lower margin
	clrBrightBrown();	DrawLine(0, 551, 800, 551) ' Lower margin
	'clrBrown();		DrawRect(0, 552, 800, 50) ' Lower bar
	'clrBlack();		DrawRect(2, 576, 796, 22) ' Console bar
	'clrBrightBrown();	DrawLine(2, 597, 797, 597) ' Console 3d effect
	'				DrawLine(797, 576, 797, 596) ' Console 3d effect
	'clrDarkBrown();	DrawLine(2, 576, 796, 576) ' Console 3d effect
	'				DrawLine(2, 576, 2, 596) ' Console 3d effect
	
	' Draw the console-input
	SetImageFont defaultFont
	clrBrightGreen(); DrawText("> " + conInputText, 5, 579)
	
	' Reset to old colors
	clrCustom(oldr,oldg,oldb)
end function
